﻿<%@ Page Language="C#" MasterPageFile="~/Danser.Master" AutoEventWireup="true" CodeBehind="DataValidationsNew.aspx.cs" Inherits="Danser_AJAXEnabledWebApplication.DataValidationsNew" Title="Danser - Data Validations" %>

<%@ Register Src="User Controls/ExpressionBuilder.ascx" TagName="ExpressionBuilder"
    TagPrefix="uc1" %>
<%@ Register src="User Controls/MultiSelectList.ascx" tagname="MultiSelectList" tagprefix="uc2" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:ScriptManager id="ScriptManager" runat="server">
    </asp:ScriptManager>
    <table width="100%">
        <tr>
            <td>
    <asp:Label ID="titleLabel" runat="server" CssClass="StandardLabel" Text="Define test validation template:"></asp:Label></td>
        </tr>
        <tr>
            <td style="height: 21px">
            </td>
        </tr>
        <tr>
            <td>

<asp:Panel ID="MainPanel" runat="server" BackColor="Lavender" Height="100%"
    Width="100%" BorderColor="MidnightBlue">
    <asp:ObjectDataSource ID="objectDataSource" runat="server" DeleteMethod="RemoveValidation"
        InsertMethod="AddValidation" SelectMethod="GetValidation" TypeName="Danser_AJAXEnabledWebApplication.DataSourceManagers.ValidationsDataSourceManager"
        UpdateMethod="MoidifyValidation">
        <DeleteParameters>
            <asp:Parameter Name="ID" Type="Int32" />
            <asp:Parameter Name="newRow" Type="Boolean" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="ID" Type="Int32" />
            <asp:Parameter Name="name" Type="String" />
            <asp:Parameter Name="appliedOnDefault" Type="Boolean" />
            <asp:Parameter Name="mailList" Type="String" />
            <asp:Parameter Name="expression" Type="String" />
            <asp:Parameter Name="newRow" Type="Boolean" />
        </UpdateParameters>
        <SelectParameters>
            <asp:Parameter Name="newRow" Type="Boolean" />
            <asp:Parameter Name="filter" Type="String" />
        </SelectParameters>
        <InsertParameters>
            <asp:Parameter Name="ID" Type="Int32" />
            <asp:Parameter Name="name" Type="String" />
            <asp:Parameter Name="appliedOnDefault" Type="Boolean" />
            <asp:Parameter Name="mailList" Type="String" />
            <asp:Parameter Name="expression" Type="String" />
        </InsertParameters>
    </asp:ObjectDataSource>
    <table width="100%">
        <tr>
            <td align="left" style="height: 34px" valign="middle">
                <asp:UpdatePanel ID="dataGridUpdatePanel" runat="server">
                    <ContentTemplate>
                        <table width="100%">
                            <tr>
                                <td>
                                    <table style="width:100%;">
                                        <tr valign="top">
                                            <td>
                                                <asp:Panel ID="FilterPanel" runat="server" Width="100%">
                                                    <table style="width:100%;">
                                                        <tr>
                                                            <td valign="top" width="200px">
                                                                <asp:Label ID="selectLabel" runat="server" Font-Bold="True" 
                                                                    Font-Names="Arial" Font-Size="10pt" ForeColor="MidnightBlue" 
                                                                    Text="Select columns to display:"></asp:Label>
                                                            </td>
                                                            <td align="left" valign="top" width="80px">
                                                                <uc2:MultiSelectList ID="columnsMultiSelectList" runat="server" />
                                                            </td>
                                                            <td align="left" valign="top">
                                                                <asp:Button ID="filterButton" runat="server" BackColor="MidnightBlue" 
                                                                    BorderColor="#C0C0FF" BorderStyle="Solid" BorderWidth="1px" 
                                                                    Font-Names="Arial" ForeColor="White" OnClick="filterButton_Click" 
                                                                    Text="Confirm" ToolTip="Display selected fields only" Width="70px" />
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </asp:Panel>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                                <td>
                                    &nbsp;</td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Button ID="filterValidationsButton" runat="server" 
                                        CssClass="StandardButton" onclick="filterValidationButton_Click" 
                                        Text="Search Templates" Width="120px" />
                                </td>
                                <td>
                                    &nbsp;</td>
                            </tr>
                            <tr>
                                <td colspan="2">
                                    <asp:Panel ID="validationsQueryPanel" runat="server" Visible="False" 
                                        Width="100%">
                                        <table style="width:100%;">
                                            <tr>
                                                <td>
                                                    <uc1:ExpressionBuilder ID="validationsQueryExpressionBuilder" runat="server" />
                                                </td>
                                            </tr>
                                            <tr>
                                                <td colspan="1">
                                                    <asp:Button ID="executeValidationQueryButton" runat="server" 
                                                        CssClass="StandardButton" onclick="executeValidationQueryButton_Click" 
                                                        Text="SELECT" ToolTip="Execute query" />
                                                </td>
                                            </tr>
                                        </table>
                                    </asp:Panel>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    &nbsp;</td>
                            </tr>
                            <tr>
                                <td>
&nbsp;</td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Button ID="selectAllButton" runat="server" BackColor="MidnightBlue" 
                                        BorderColor="#C0C0FF" BorderStyle="Solid" BorderWidth="1px" 
                                        Font-Names="Arial" ForeColor="White" OnClick="selectAllButton_Click" 
                                        Text="All" ToolTip="Select all rows" Width="70px" />
                                    &nbsp;&nbsp;&nbsp;
                                    <asp:Button ID="selectNoneButton" runat="server" BackColor="MidnightBlue" 
                                        BorderColor="#C0C0FF" BorderStyle="Solid" BorderWidth="1px" 
                                        Font-Names="Arial" ForeColor="White" 
                                        OnClick="selectNoneButton_Click" Text="None" ToolTip="Deselect all rows" 
                                        Width="70px" />
                                    <asp:Panel ID="noRuleGeneratedPanel" runat="server" Visible="False">
                                        <table style="width:100%;">
                                            <tr>
                                                <td class="style15">
                                                    <asp:Image ID="Image2" runat="server" 
                                                        ImageUrl="~/Resourses/Images/warning.bmp" />
                                                </td>
                                                <td>
                                                    <asp:Label ID="noRuleGeneratedLabel" runat="server" 
                                                        Font-Names="Arial" Font-Size="10pt" ForeColor="Black" 
                                                        Text="No rule expression was generated for the validation template"></asp:Label>
                                                </td>
                                            </tr>
                                        </table>
                                    </asp:Panel>
                                    <asp:UpdateProgress ID="validtionsUpdateProgress" runat="server" 
                                        AssociatedUpdatePanelID="dataGridUpdatePanel" DisplayAfter="300">
                                        <ProgressTemplate>
                                            <table style="width:100%;">
                                                <tr>
                                                    <td>
                                                        <asp:Image ID="Image1" runat="server" ImageUrl="~/Resourses/Images/info.bmp" />
                                                    </td>
                                                    <td>
                                                        <asp:Label ID="waitLabel" runat="server" Font-Bold="False" 
                                                            Font-Names="Arial" Font-Size="10pt" ForeColor="Black" 
                                                            Text="Please wait while executing..."></asp:Label>
                                                    </td>
                                                </tr>
                                            </table>
                                        </ProgressTemplate>
                                    </asp:UpdateProgress>
                                </td>
                            </tr>
                            <tr>
                                <td align="left" 
                                    valign="top" width="800px">
                                    <asp:GridView ID="dataGridView" runat="server" AutoGenerateColumns="False" 
                                        BackColor="LightGray" BorderColor="White" BorderStyle="Solid" BorderWidth="1px" 
                                        DataKeyNames="ID" DataSourceID="objectDataSource" 
                                        EmptyDataText="&lt; No Entries to Display &gt;" 
                                        onrowdatabound="dataGridView_RowDataBound" 
                                        onrowupdating="dataGridView_RowUpdating" Width="100%" AllowPaging="True">
                                        <RowStyle BorderColor="White" BorderStyle="Solid" BorderWidth="1px" 
                                            Font-Names="Arial" HorizontalAlign="Center" 
                                            VerticalAlign="Middle" CssClass="StandardRowStyle" Font-Size="11pt" />
                                        <EmptyDataRowStyle Font-Italic="True" Font-Names="Arial" 
                                            Font-Size="10pt" HorizontalAlign="Center" VerticalAlign="Middle" />
                                        <Columns>
                                            <asp:TemplateField>
                                                <EditItemTemplate>
                                                    <table>
                                                        <tr>
                                                            <td align="left" style="width: 60px" valign="middle">
                                                                <asp:Button ID="saveRowButton" runat="server" BackColor="MidnightBlue" 
                                                                    BorderColor="#C0C0FF" BorderStyle="Solid" BorderWidth="1px" ForeColor="White" 
                                                                    OnClick="saveRowButton_Click" Text="Save" ToolTip="Save changes in row" 
                                                                    Width="60px" />
                                                            </td>
                                                            <td align="left" style="width: 60px" valign="middle">
                                                                <asp:Button ID="cancelRowButton" runat="server" BackColor="MidnightBlue" 
                                                                    BorderColor="#C0C0FF" BorderStyle="Solid" BorderWidth="1px" ForeColor="White" 
                                                                    OnClick="cancelRowButton_Click" Text="Cancel" ToolTip="Undo changes in row" 
                                                                    Width="60px" />
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </EditItemTemplate>
                                                <ItemTemplate>
                                                    <asp:CheckBox ID="rowSelector" runat="server" />
                                                </ItemTemplate>
                                                <HeaderStyle BorderColor="White" BorderStyle="Solid" BorderWidth="1px" 
                                                    Width="25px" />
                                                <ItemStyle BorderColor="White" BorderStyle="Solid" BorderWidth="1px" 
                                                    HorizontalAlign="Center" VerticalAlign="Middle" />
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Name">
                                                <EditItemTemplate>
                                                    <asp:TextBox ID="nameTextBox" runat="server" Text='<%# Eval("Name") %>' 
                                                        Width="95%"></asp:TextBox>
                                                    <asp:Label ID="displayNameOnModifyLabel" runat="server" 
                                                        Text='<%# Eval("Name") %>' Visible="False"></asp:Label>
                                                </EditItemTemplate>
                                                <ItemTemplate>
                                                    <asp:Label ID="nameLabel" runat="server" Text='<%# Eval("Name") %>'></asp:Label>
                                                </ItemTemplate>
                                                <HeaderStyle BorderColor="White" BorderStyle="Solid" BorderWidth="1px" />
                                                <ItemStyle BorderColor="White" BorderStyle="Solid" BorderWidth="1px" 
                                                    Width="150px" />
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Default">
                                                <EditItemTemplate>
                                                    <asp:CheckBox ID="appliedOnDefaultCheckBox" runat="server" 
                                                        Checked='<%# Eval("AppliedOnDefault") %>' />
                                                </EditItemTemplate>
                                                <ItemTemplate>
                                                    <asp:Label ID="appliedOnDefaultLabel" runat="server" 
                                                        Text='<%# Eval("AppliedOnDefault") %>'></asp:Label>
                                                </ItemTemplate>
                                                <HeaderStyle BorderColor="White" BorderStyle="Solid" BorderWidth="1px" />
                                                <ItemStyle BorderColor="White" BorderStyle="Solid" BorderWidth="1px" 
                                                    Width="50px" />
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Mail List">
                                                <EditItemTemplate>
                                                    <table width="100%">
                                                        <tr>
                                                            <td align="center">

                                                                <asp:Label ID="insertAddressLabel" runat="server" Font-Names="Arial" 
                                                                    Font-Size="8pt" Text="Insert single mail address in each line"></asp:Label>
                                                                <asp:Panel ID="errorMessagePanel" runat="server" HorizontalAlign="Center" 
                                                                    Visible="False">
                                                                    <asp:Label ID="errorMessageLabel" runat="server" Font-Names="Arial" 
                                                                        Font-Size="8pt" ForeColor="Red"></asp:Label>
                                                                </asp:Panel>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td align="center">
                                                                <asp:TextBox ID="mailListListBox" runat="server" Rows="3" 
                                                                    Text='<%# Eval("MailList") %>' TextMode="MultiLine" Width="95%"></asp:TextBox>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </EditItemTemplate>
                                                <ItemTemplate>
                                                    <asp:Label ID="mailistLabel" runat="server" Text='<%# Eval("MailList") %>'></asp:Label>
                                                </ItemTemplate>
                                                <HeaderStyle BorderColor="White" BorderStyle="Solid" BorderWidth="1px" />
                                                <ItemStyle BorderColor="White" BorderStyle="Solid" BorderWidth="1px" 
                                                    Width="200px" />
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Validation Rule">
                                                <EditItemTemplate>
                                                    <asp:LinkButton ID="editRuleLinkButton" runat="server" 
                                                        Font-Names="Arial" Font-Size="10pt" ForeColor="MidnightBlue" 
                                                        onclick="editRuleLinkButton_Click">Create Rule</asp:LinkButton>
                                                    <asp:Label ID="displayRuleOnModifyLabel" runat="server" Visible="False" 
                                                        Font-Names="Arial" Font-Size="10pt"></asp:Label>
                                                </EditItemTemplate>
                                                <ItemTemplate>
                                                    <asp:Label ID="ruleLabel" runat="server" Text='<%# Eval("Expression") %>' 
                                                        Font-Names="Arial" Font-Size="10pt"></asp:Label>
                                                </ItemTemplate>
                                                <HeaderStyle BorderColor="White" BorderStyle="Solid" BorderWidth="1px" />
                                                <ItemStyle BorderColor="White" BorderStyle="Solid" BorderWidth="1px" 
                                                    Width="450px" />
                                            </asp:TemplateField>
                                        </Columns>
                                        <HeaderStyle BackColor="#C0C0FF" BorderColor="White" BorderStyle="Solid" 
                                            BorderWidth="1px" Font-Bold="True" Font-Names="Arial" 
                                            Font-Size="12pt" ForeColor="MidnightBlue" HorizontalAlign="Center" 
                                            VerticalAlign="Middle" />
                                        <EditRowStyle CssClass="StandardRowStyle" />
                                        <AlternatingRowStyle BackColor="Gainsboro" BorderColor="White" 
                                            BorderStyle="Solid" BorderWidth="1px" CssClass="StandardRowStyle" 
                                            Font-Names="Arial" Font-Size="11pt" />
                                        <PagerStyle Font-Bold="True" 
                                            Font-Names="Arial" Font-Overline="False" Font-Underline="False" 
                                            ForeColor="MidnightBlue" HorizontalAlign="Center" 
                                            CssClass="StandardPagerStyle" Font-Size="12pt" VerticalAlign="Middle" 
                                            BorderColor="White" BorderStyle="Solid" BorderWidth="1px" />
                                    </asp:GridView>
                                </td>
                                <td align="right" style="height: 166px" valign="top" width="90px">
                                    <asp:Panel ID="buttonsPanel" runat="server" HorizontalAlign="Right">
                                        <asp:Button ID="addButton" runat="server" BackColor="MidnightBlue" 
                                            BorderColor="#C0C0FF" BorderStyle="Solid" BorderWidth="1px" 
                                            Font-Names="Arial" ForeColor="White" OnClick="addButton_Click" 
                                            Text="Add" ToolTip="Add new item to list" Width="70px" />
                                        <br />
                                        <br />
                                        <asp:Button ID="modifyButton" runat="server" BackColor="MidnightBlue" 
                                            BorderColor="#C0C0FF" BorderStyle="Solid" BorderWidth="1px" 
                                            Font-Names="Arial" ForeColor="White" OnClick="modifyButton_Click" 
                                            Text="Modify" ToolTip="Modify selected item" Width="70px" />
                                        <br />
                                        <br />
                                        <asp:Button ID="removeButton" runat="server" BackColor="MidnightBlue" 
                                            BorderColor="#C0C0FF" BorderStyle="Solid" BorderWidth="1px" 
                                            Font-Names="Arial" ForeColor="White" OnClick="removeButton_Click" 
                                            Text="Remove" ToolTip="Remove selected item" Width="70px" />
                                    </asp:Panel>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2">
                                    &nbsp;
                                <asp:Panel ID="conditionsPane" runat="server" Width="100%">
                                &nbsp;<uc1:ExpressionBuilder ID="expressionBuilder" runat="server" 
                                    Visible="False" />
                                </asp:Panel>
                                </td>
                            </tr>
                        </table>

                    </ContentTemplate>
                    <Triggers>
                        <asp:PostBackTrigger ControlID="filterButton" />
                    </Triggers>
                </asp:UpdatePanel>
            </td>
        </tr>
    </table>
</asp:Panel>
            </td>
        </tr>
        </table>
</asp:Content>


<asp:Content ID="Content2" runat="server" contentplaceholderid="head">

    <style type="text/css">
        .style1
        {
            width: 24px;
        }
        .style15
        {
            width: 23px;
        }
    </style>

</asp:Content>



